/**
 * Created by bgy on 2016/12/29.
 */

var attachment_server_url = "http://a8-domain.pagoda.com.cn:20101";

var common = {
  picUpload: function () {
    var picUploadParam = JSON.parse(window.localStorage.getItem('picUploadParam'));
    for (var i = 0; i < picUploadParam.length; i++) {
      if (picUploadParam[i].fmFiles.length > 0) {
        for (var j = 0; j < picUploadParam[i].fmFiles.length; j++) {//删除没有照片的fmFiles；
          if (!picUploadParam[i].fmFiles[j].fileKey) {
            picUploadParam[i].fmFiles.splice(j, 1);
          }
        }
        if (picUploadParam[i].fmFiles.length > 0) {//有图片上传的，保存到图片服务器。
          $.post({
            url: attachment_server_url + '/fileMgr/updateFilesByFileUseCode',
            async: false,
            data: JSON.stringify(picUploadParam[i]),
            contentType: 'application/json',
            dataType: 'json',
            success: function (data) {
            },
          });
        }
      }
    }
    window.localStorage.removeItem('picUploadParam');
  }
}
export default common;
